//
//  IntegralMallCollectionViewCell.m
//  lmq
//
//  Created by 马田成 on 2017/4/2.
//  Copyright © 2017年 yuanxin. All rights reserved.
//

#import "IntegralMallCollectionViewCell.h"
#import "HomeIntegralMallModel.h"
#import "UIImageView+WebCache.h"

@implementation IntegralMallCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.ImmediatelyButton.layer.borderWidth = 1.0f;
    self.ImmediatelyButton.layer.borderColor = [UIColor redColor].CGColor;
    
    
    
    // Initialization code
}
- (IBAction)ImmediatelyButton:(UIButton *)sender {
    if (self.block) {
        self.block(sender);
    }
    
    
}
- (void)callBackEditBlock:(EditBlock)block{
    self.block = block;
}

- (void)setModelOfIntegral:(HomeIntegralMallModel *)modelOfIntegral{
    _modelOfIntegral = modelOfIntegral;
    
//    NSString *strPic = @"http://lmq.quyum.cn/";
//    
//    NSString *str = [strPic stringByAppendingString:modelOfIntegral.pic];
    
    NSString *urlWare=modelOfIntegral.pic;
    NSString *urlN=manage(AP_HOST, urlWare);
    
    NSString *strUrl = [urlN stringByReplacingOccurrencesOfString:@"\\" withString:@"/"];
    
//    [self.picImageView sd_setImageWithURL:[NSURL URLWithString:strUrl]];
    
    
    [self.picImageView sd_setImageWithURL:[NSURL URLWithString:strUrl] placeholderImage:[UIImage imageNamed:@"liyi"]];
    
    
    self.titleLabel.text = modelOfIntegral.name;
    float num = modelOfIntegral.purchase ;
    float numOfPeople = num - modelOfIntegral.buy;
    
    self.peopleNumber.text = [NSString stringWithFormat:@"%ld", (long)numOfPeople];
    
    
    self.progressView.progress = modelOfIntegral.buy / num;
    
    
    

}


@end
